package util.android.widgets;

import util.android.form.respuesta.DateTimePickerInput;

import com.androidutil.R;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.DatePicker;
import android.widget.LinearLayout;
import android.widget.TimePicker;

public class FechaHoraView 
extends AbstractView2<DateTimePickerInput,FechaHoraView>
{
	
	public FechaHoraView(Context context, AttributeSet attrs) {
		super(context, attrs);		
	}
	
	@Override
	protected DateTimePickerInput crearInput_agregarVistas() {
		LinearLayout ly = (LinearLayout) View.inflate(getContext(), R.layout.view_fecha_hora, null);
		
		DatePicker dp = (DatePicker) ly.findViewWithTag("fecha");
		TimePicker tp = (TimePicker) ly.findViewWithTag("hora");
		
		DateTimePickerInput in = new DateTimePickerInput(dp,tp);
		
		this.getLayoutRespuesta().addView(ly);
		//ViewUtil.addViewMatch_Wrap(lyRespuesta, inValor.getTextView());
		return in;
	}
	
	protected void onHabilitableChanged(boolean isChecked) {
		super.onHabilitableChanged(isChecked);
		this.getInput().getInput1().getView().setEnabled(isChecked);
		this.getInput().getInput2().getView().setEnabled(isChecked);
	}
	
}
